package com.csk.zsk.compents.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import com.csk.zsk.commons.entity.IdEntity;
@Entity
@Table(name = "COMIC")
@JsonIgnoreProperties({ "comicChaptersList" })
public class Comic extends IdEntity {
	private String name;
	private String url;
	private String pageurl;
	private String state;
	private String author;
	private String content;
	private Integer ordernum;
	private Integer recnum;
	private List<ComicChapters> comicChaptersList;
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getPageurl() {
		return pageurl;
	}
	public void setPageurl(String pageurl) {
		this.pageurl = pageurl;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	@OneToMany(mappedBy = "comic", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY, orphanRemoval = true)
	@Fetch(FetchMode.SUBSELECT)
	@OrderBy(value = "num DESC")
	public List<ComicChapters> getComicChaptersList() {
		return comicChaptersList;
	}
	public void setComicChaptersList(List<ComicChapters> comicChaptersList) {
		this.comicChaptersList = comicChaptersList;
	}
	public Integer getOrdernum() {
		return ordernum;
	}
	public void setOrdernum(Integer ordernum) {
		this.ordernum = ordernum;
	}
	public Integer getRecnum() {
		return recnum;
	}
	public void setRecnum(Integer recnum) {
		this.recnum = recnum;
	}
	
	
	
}
